-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Add mouse, resolution, and time-based uniforms to bloomShaderCallback #7999
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev-2.0
Are you sure you want to change the base?
Conversation
Hey Lalit! The idea for this issue is to add documentation to the reference. This is done by writing JSDoc comments which get pulled in when the p5.js website is built and reference pages are generated. Look here for the contributor guidelines for JS Doc: Once you've put this code into a JSDoc comment, commit and push the results, and then run the command |
Oh also in #7849 (comment) I was mentioning those uniforms as things that would be good to have as built-in nodes, so they don't need to be manually added to reference examples. So for those you'd probably need to modify the ShaderGenerator.js file like you were doing for noise and lerp. |
Hi! While testing the changes locally using
Just to clarify, I haven’t edited these files, the errors appeared during preview and seem unrelated to my PR. Thought I’d flag it here in case it's helpful. Thanks! |
Do you mind checking with the 2.0 branch of p5.js-website? That should probably work for you, Sorry, for the late response and also thanks for your patience and great work so far! :) |
Hi @LalitNarayanYadav I wanted to check in here as well. Are you still working on this PR? Please ping in the next week (no need to be finished by then, just to confirm you're still on it) - otherwise we can finish it up. Thank you! |
Hi @ksen0, |
Summary
This PR enhances the existing
bloomShaderCallback
in thepreview/global/sketch.js
example to demonstrate how commonly used uniforms can be integrated with p5.strands. The following uniforms were added:mouse
: current mouse position ([mouseX, mouseY]
)resolution
: current canvas size ([width, height]
)millis
: time in ms since the sketch startedframeCount
: total number of frames rendereddeltaTime
: time elapsed between framesThese values are passed into the shader using
uniformVec2
anduniformFloat
, then used in the bloom shader’s glow calculation.This contribution addresses #7849, specifically the need to bridge p5.js values like
mouseX
,width
,millis()
, andframeCount
into thep5.strands
system.Test Plan
preview/global/sketch.js
millis
)The result should reflect both interactive and time-based changes.
cc: @davepagurek @ksen0 @lukeplowden
PR Checklist
npm run lint
passes